﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Windows.Forms;

namespace ControleEstoque.PDA
{
	static class Program
	{
		static ControleEstoqueServices.Services _currentService;

		public static ControleEstoqueServices.Services CurrentService
		{
			get
			{
				if (_currentService == null)
				{
					_currentService = new ControleEstoque.PDA.ControleEstoqueServices.Services();
					
				}
				return _currentService;
			}
		}

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[MTAThread]
		static void Main()
		{
			DialogResult loggedIn;
			ControleEstoque.PDA.ControleEstoqueServices.ControleAtivoDataSet.UsuarioRow currentUser = null;

			using (Login loginForm = new Login())
			{
				loggedIn = loginForm.ShowDialog();
				currentUser = loginForm.CurrentUser;
			}

			if (loggedIn == DialogResult.OK && currentUser != null)
			{
				ControleEstoqueForm form = new ControleEstoqueForm();
				form.CurrentUser = currentUser;
				Application.Run(new ControleEstoqueForm());
			}
		}
	}
}